<template>
  <div id="face-real-time">
    <el-divider>人脸实时检测</el-divider>
    <RealTime :real-time-img="realTimeImg" :real-time-img2="realTimeImg2" :real-time-img3="realTimeImg3" :real-time-img4="realTimeImg4" />
  </div>
</template>

<script>
import RealTime from '@/components/RealTime'
import { BASE_DETECT_URL } from '@/api/realTime'

export default {
  name: 'FaceRealTime',
  components: {
    RealTime
  },
  data() {
    return {
      // realTimeImg: BASE_DETECT_URL + '/face_detect_realtime'
      realTimeImg: '',
      realTimeImg2: '',
      realTimeImg3: '',
      realTimeImg4: ''
    }
  },
  created() {
    if (!this.$store.getters.useVideo) {
      this.realTimeImg = BASE_DETECT_URL + '/face_detect_realtime'
      console.log(this.realTimeImg)
    } else {
      if (this.$store.state.camera.camera1.detectFlag) {
        this.realTimeImg = BASE_DETECT_URL + '/face_detect_realtime' + '?monitor_id=' + this.$store.state.camera.camera1.url + '&loop=' + this.$store.state.camera.loop
      }
      if (this.$store.state.camera.camera2.detectFlag) {
        this.realTimeImg2 = BASE_DETECT_URL + '/face_detect_realtime' + '?monitor_id=' + this.$store.state.camera.camera2.url + '&loop=' + this.$store.state.camera.loop
      }
      if (this.$store.state.camera.camera3.detectFlag) {
        this.realTimeImg3 = BASE_DETECT_URL + '/face_detect_realtime' + '?monitor_id=' + this.$store.state.camera.camera3.url + '&loop=' + this.$store.state.camera.loop
      }
      if (this.$store.state.camera.camera4.detectFlag) {
        this.realTimeImg4 = BASE_DETECT_URL + '/face_detect_realtime' + '?monitor_id=' + this.$store.state.camera.camera4.url + '&loop=' + this.$store.state.camera.loop
      }
    }
  },
  mounted() {
    if (location.href.indexOf('#reloaded') === -1) {
      location.href = location.href + '#reloaded'
      location.reload()
    }
  }
}
</script>

<style scoped>

</style>
